export class HallButton {
    button: UiText;
    constructor(parent: UiNode) {
        this.button = UiText.create();
        this.button.parent = parent;
        this.button.size.offset.copy(
            Vec2.create({ x: screenWidth / 10, y: screenWidth / 20 })
        );
        this.button.position.offset.copy(
            Vec2.create({
                x: -this.button.size.offset.x / 2,
                y: -this.button.size.offset.y / 2,
            })
        );
        this.button.position.scale.copy(Vec2.create({ x: 0.9, y: 0.05 }));
        this.button.backgroundColor.copy(Vec3.create({ r: 0, g: 0, b: 0 }));
        this.button.backgroundOpacity = 1;
        this.button.textXAlignment = 'Center';
        this.button.textXAlignment = 'Center';
        this.button.textContent = '作品展厅';
        this.button.textFontSize = Math.min(
            screenWidth / 20,
            screenHeight / 20
        );
        this.button.textColor.copy(Vec3.create({ r: 255, g: 255, b: 255 }));
    }

    onClick(handler: () => void): void {
        if (this.button) {
            this.button.events.on('pointerup', handler);
        }
    }
}
